home *** CD-ROM | disk | FTP | other *** search
- /*
- ** TESTDRV
- **
- ** Device Driver Test for MSCDEX compatible CD-ROM
- **
- ** FILE: test.h
- **
- **
- ** HISTORY:
- ** 10/01/90 Final (v1.0) -by- JYG
- */
-
- // Header File Sourcing
-
- #include<stdlib.h>
- #include<stdio.h>
- #include<conio.h>
- #include<ctype.h>
- #include<dos.h>
- #include<memory.h>
- #include<string.h>
-
- // Basic types
-
- typedef unsigned char uchar;
- typedef unsigned short ushort;
- typedef unsigned int uint;
- typedef unsigned long ulong;
-
- typedef unsigned char BYTE;
- typedef unsigned short WORD;
- typedef unsigned long DWORD;
- typedef char FLAG;
-
- // Macros for building/taking apart long's
-
- #define MAKELONG(lo, hi) ((long)(((unsigned)(lo)) | ((unsigned long)((unsigned)(hi))) << 16))
- #define LOWORD(l) ((WORD)(DWORD)(l))
- #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xffff))
- #define LOBYTE(w) ((BYTE)(w))
- #define HIBYTE(w) (((WORD)(w) >> 8) & 0xff)
-
- #define TRUE (0==0)
- #define FALSE (0!=0)
- #define UNSET (-1)
-
- /* *** Device header structure definition *** */
-
- #define SIGFIELD "MSCD00"
-
- /* Format for CDROM device driver header at CS:0 of device driver
- ** Slightly extended from standard MSDOS character device driver
- */
-
- #define PROGNAME "TESTDRV"
-
- // Read/Write Mode
-
- #define COOKED_MODE 0x00
- #define RAW_MODE 0x01
-
- // Addressing Modes
-
- #define HSG_ADDRMODE 0x00
- #define REDBOOK_ADDRMODE 0x01
-
- // Status word masks
-
- #define DONEBIT 0x0100 //DONE if Bit 8 is set
- #define ERRORBIT 0x8000 //Error if Bit 15 is set
- #define BUSYBIT 0x0200 //BUSY if Bit 9
- #define ERRORMASK 0x00FF //Lower 8 bits
- #define UNKNOWN_CMD 0x8003
- #define SEC_INIT_ERR 0x0003 //Second time INIT error
-
- // DevStatus selector masks
-
- #define DEVSTAT_DROPEN 0x00000001
- #define DEVSTAT_DRLOCK 0x00000002
- #define DEVSTAT_RAW 0x00000004
- #define DEVSTAT_WRITE 0x00000008
- #define DEVSTAT_AUDVID 0x00000010
- #define DEVSTAT_INTERLEAVE 0x00000020
- // RESERVED 0x00000040
- #define DEVSTAT_PREFETCH 0x00000080
- #define DEVSTAT_AUDCTRL 0x00000100
- #define DEVSTAT_REDBOOK 0x00000200
- // RESERVED 0x00000400
- #define DEVSTAT_NODISK 0x00000800
- #define DEVSTAT_SUBINFO 0x00001000
-
- #define LOCK_DOOR 0x01
- #define UNLOCK_DOOR 0x00
-
- #define RAW_SECTOR_SIZE 2352
- #define COOKED_SECTOR_SIZE 2048
-
- #define AUDIO_PAUSEDBIT 0x0001
- #define SECTOR_NOT_FND 0x0008
- #define DRV_NOT_READY 0x0002
-
- //
- // Request name structure
- //
-
- typedef struct _ReqName {
- BYTE bCmd,bSubCmd;
- char * CmdName;
- } ReqName;
-
- //
- // Enumerated types for accessing tests and request structures
- //
-
- enum test {tINIT=0,tDEVSTAT,tRADDR,tRESET,tLOCKDOOR,tDRVBYTES,tRESERVEDCMD,
- tSECTORSIZE,tUPCCODE,tVOLSIZE,tEJECT,tAUDIODISK,tSECTORDUMP,tTESTCONTROL};
-
- enum request {rINIT=0,rIRADDR,rILOCHEAD,rIERRSTAT,rIAUDINFO,rIDRVBYTES,
- rIDEVSTAT,rISECTSIZE,rIVOLSIZE,rIMEDCHNG,rIDISKINFO,rITNOINFO,rIQINFO,
- rISUBINFO,rIUPCCODE,rIAUDSTAT,rOEJECT,rOLOCKDOOR,rORESET,rOAUDINFO,
- rODRVBYTES,rOCLOSETRAY,rREADL,rREADLPRE,rSEEK,rPLAY,rSTOP,rRESUME,rWRITE,
- rWRITELV,rFLUSHI,rFLUSHO,rDOPEN,rDCLOSE,rRESERVED,rIRESERVED,rORESERVED};
-
- //
- // MACROS
- //
-
- #define fileErrorTest(x) \
- {\
- if((x)<=0)\
- fatalError("File Error Reading/Writing");\
- }
- #define AINFEQU(x,y) \
- ((x.in0 == y.in0)&&(x.vol0 == y.vol0)&&\
- (x.in1 == y.in1)&&(x.vol1 == y.vol1)&&\
- (x.in2 == y.in2)&&(x.vol2 == y.vol2)&&\
- (x.in3 == y.in3)&&(x.vol3 == y.vol3))
- #define EXOR(x,y) (((x) && !(y))||((!x) && (y)))
- extern char * szTesting;
- #define StatusTest(a,b,c) \
- {\
- if(fVerbose) Msg(c,szTesting,""); \
- a=b; \
- if (fVerbose) InterpStatus(a); \
- }
-
- //
- // Definitions for Audio track control parameters
- //
-
- #define TWO_AUD_NOPRE 0xD0
- #define TWO_AUD_PRE 0x10
- #define FOUR_AUD_NOPRE 0x80
- #define FOUR_AUD_PRE 0x90
- #define DATA_TRACK 0x40
- #define AUD_RESERVED 0xF0
- #define DIG_COPY_PROHI 0x0
- #define DIG_COPY_PERM 0x0
-
- //
- // function prototypes
- //
-
- #include"rstruct.h"
- #include"proto.h"
- #include "message.h"